"""
Case Type   : 事务-ustore
Case Name   : 清理环境
Create At   : 2022/1/14
Owner       : @kyleze
Description :
    1.清理环境
Expect      :
    1.成功
History     :
"""
import os
import unittest

from yat.test import Node

from testcase.utils.CommonSH import CommonSH
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger


class USTORE(unittest.TestCase):
    def setUp(self):
        self.pri_user = Node('PrimaryDbUser')
        self.pri_sh = CommonSH('PrimaryDbUser')
        self.constant = Constant()
        self.log = Logger()
        self.schema = 'schema_ustore_trans'
        self.table = 't_ustore_trans_0001'
        text = f'----{os.path.basename(__file__)} start----'
        self.log.info(text)

    def testunit_1(self):
        text = '----step1:清理环境;expect:成功----'
        self.log.info(text)
        q_str = f'''drop schema if exists schema_ustore_trans cascade;'''
        self.log.info(q_str)
        q_res = self.pri_sh.execut_db_sql(q_str)
        self.log.info(q_res)
        self.assertIn(self.constant.DROP_SCHEMA_SUCCESS_MSG, q_res,
                      '执行失败: ' + text)

    def tearDown(self):
        self.log.info(f'---{os.path.basename(__file__)} end---')

